<template>
  <div class="u-p-20">
    <el-card shadow="never">
      <div slot="header">
        <span>
          <b class="u-f-16">公益收入列表</b>
        </span>
        <router-link :to="{name:'incomeEdit'}" v-if="hasPerm('incomeEdit')">
          <el-button
            type="danger"
            size="small"
            icon="el-icon-plus"
            class="u-right u-5mt"
            round
          >添加公益收入</el-button>
        </router-link>
      </div>

      <el-form :inline="true" :model="queryForm" size="small" class="u-text-center">
        <el-form-item label="备注信息">
          <el-input v-model="queryForm.keyword" placeholder="输入备注信息标题查询" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="getPageData(true)">查询</el-button>
        </el-form-item>
      </el-form>
      <el-tag>资金总额：{{other}}(元)</el-tag>
      <el-table :data="tableData" class="u-mt-10" v-viewer>
        <el-table-column label="id" prop="id" width="100"></el-table-column>
        <el-table-column label="头像" width="100">
          <template slot-scope="scope">
            <el-image
              style="max-width: 60px;border-radius: 60px;"
              :src="scope.row.head_img"
              :data-src="scope.row.head_img"
              fit="cover"
              lazy
            ></el-image>
          </template>
        </el-table-column>
        <el-table-column label="昵称" prop="nick_name"></el-table-column>
        <el-table-column label="备注信息" prop="remark"></el-table-column>
        <el-table-column label="收入时间" prop="add_time"></el-table-column>
        <el-table-column label="收入资金" prop="capital"></el-table-column>
        <el-table-column label="添加日期" prop="create_time" sortable></el-table-column>
        <el-table-column label="操作" width="220">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              @click.native="handleRoute(scope.row.id,'incomeEdit')"
              v-if="hasPerm('incomeEdit')"
            >编辑</el-button>
            <el-button
              size="mini"
              type="text"
              @click.native="handleDelete(scope.row.id)"
              v-if="hasPerm('incomeDelBtn')"
            >删除</el-button>
          </template>
        </el-table-column>
      </el-table>

      <div class="u-mt-20 u-text-center">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handlePageChange"
          :current-page="currentPage"
          :page-sizes="[10, 20, 30, 40, 50]"
          :page-size="limit"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
      </div>
    </el-card>
  </div>
</template>

<script>
import commonPage from "@/mixins/common-page";
export default {
  mixins: [commonPage],
  components: {},
  props: {},
  data() {
    return {
      apiName: "income",
      queryForm: {
        status: "",
        keyword: ""
      }
    };
  },
  methods: {},
  mounted() {}
};
</script>
